package view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Rectangle;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;


/**
 * The Class CompareReportGUI that extends AbstractGUI.
 * @author yudku
 */
public class CompareReportGUI  extends AbstractGUI
{
	
	/** The report1. */
	private JTextArea report1 = null;
	
	/** The report2. */
	private JTextArea report2 = null;
	
	/** The report label1. */
	private JLabel reportLabel1 = null;
	
	/** The report label2. */
	private JLabel reportLabel2 = null;
	
	/** The Reply text area. */
	private JTextArea ReplyTextArea = null;
	
	/** The comp text field. */
	private JTextField compTextField=null;
	
	/** The content pane. */
	private JPanel contentPane=null;
	
	/** The wrn message. */
	private JLabel wrnMessage=null;
	
	

	/**
	 * This is ComplaintDetailsGUI constructor.
	 * 
	 */
	public CompareReportGUI ()
	{ 		  
		
		super();
		
		 //Complain tDetails panel
		   contentPane=new JPanel();	
		  //Main Panel 
		   contentPane.setBorder(new TitledBorder(null, "Compare Report", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		   contentPane.setLayout(null);
		   contentPane.setOpaque(true);
		
		   contentPane.add(getReport1());
		   contentPane.add(getReport2());
		   contentPane.add(getReportLabel1());
			contentPane.add(getReportLabel2());
			contentPane.add(getBackButton(),BorderLayout.SOUTH);
			contentPane.add(getWrnMessage());
	        

			  //Frame
		        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		        this.setTitle("Compare Report Window");
		        this.setContentPane(contentPane);  
		        
		       
		       
			    this.setLocationRelativeTo(null); //This will center the JFrame in the middle of the screen
		        this.setLocationByPlatform(true);
		        this.setSize(700, 900);         
	               
	  }
		
	/**
	 * Gets the report label1.
	 *
	 * @return the report label1
	 */
	private JLabel getReportLabel1() {
		if (reportLabel1 == null) {
			reportLabel1 = new JLabel("Report 1");
			reportLabel1.setBounds(new Rectangle(30, 40, 70, 20));
			  
		}
		return reportLabel1;
	}
	
	
	/**
	 * Gets the report label2.
	 *
	 * @return the report label2
	 */
	private JLabel getReportLabel2() {
		if (reportLabel2 == null) {
			reportLabel2 = new JLabel("Report 2 ");
			reportLabel2.setBounds(new Rectangle(30, 470, 70, 20));
			  
		}
		return reportLabel2;
	}
	
	/**
	 * Gets the report1.
	 *
	 * @return the report1
	 */
	private JTextArea getReport1() {
		if (report1 == null) {
			report1 = new JTextArea();
			report1.setBounds(new Rectangle(30, 70, 500, 300));
			report1.setBorder(BorderFactory.createLineBorder(Color.BLACK));
			
		}
		return report1;
	}
	

	/**
	 * Gets the report2.
	 *
	 * @return the report2
	 */
	private JTextArea getReport2() {
		if (report2 == null) {
			report2 = new JTextArea();
			report2.setBounds(new Rectangle(30, 400, 500, 300));
			report2.setBorder(BorderFactory.createLineBorder(Color.BLACK));
			
		}
		return report2;
	}
	
/*
	private JTextArea getReplyArea() {
		if (ReplyTextArea == null) {
			ReplyTextArea = new JTextArea();			
			ReplyTextArea.setBounds(new Rectangle(50, 200, 350, 100));
			ReplyTextArea.setBorder(BorderFactory.createLineBorder(Color.BLACK));
			
		}
		return ReplyTextArea;
	}
	*/

	/**
	 * This method creates warning message if currently is null.
	 * @return JLabel type.
	 */
	private JLabel getWrnMessage() {
		if (wrnMessage == null) {
			wrnMessage = new JLabel();
			wrnMessage.setForeground(Color.RED);
			wrnMessage.setBounds(70, 16, 320, 23);
			wrnMessage.setVisible(false);
		}
		return wrnMessage;
	}
	
	/**
	 * This method initializes Back Button.
	 *
	 * @return the back button
	 */
	private JButton getBackButton() {
		if (backButton == null) {
			backButton = new JButton();
			backButton.setBounds(new Rectangle(550, 800, 100, 30));
			backButton.setText("Back");
		
		}
		return backButton;
	}
	
	
	

	/**
	 * *********************************Public Methods.
	 *
	 * @param msg the msg
	 */

	public void displayWrnMessage(String msg){
		wrnMessage.setText(msg);
		wrnMessage.setVisible(true);
	}
	

	/**
	 * Gets the report1 l.
	 *
	 * @return the report1 l
	 */
	public JLabel getReport1L() {
		
		return reportLabel1;
	}
	

	/**
	 * Gets the report2 l.
	 *
	 * @return the report2 l
	 */
	public JLabel getReport2L() {
	
		return reportLabel2;
	}
	
	/**
	 * Sets the gen label.
	 *
	 * @param text the text
	 * @param label the label
	 */
	public void SetGenLabel(String text,JLabel label) {
		if (label != null) {

			label.setText(text);
		}
	}
	
	/**
	 * This set complaintField Area.
	 *
	 * @param msg the new report area1
	 */
	
	public void setReportArea1(String msg){
		report1.setText(msg);
		report1.setVisible(true);
	}
		
	/**
	 * Sets the report area2.
	 *
	 * @param msg the new report area2
	 */
	public void setReportArea2(String msg){
		report2.setText(msg);
		report2.setVisible(true);
	}					
	
}

